﻿using System;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace HiauPdm.Web
{
    public partial class Logout : Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            Response.Expires = -1;
            // 退出登录
            if (Session["LoginTime"] != null)
            {
                Application["SessionUsers"] = ((int)Application["SessionUsers"]) - 1;
            }
            try
            {
                FormsAuthentication.SignOut();
                Session.Clear();
                Session.Abandon();
            }
            catch { }
            // 退出或重新登录
            if (Request.QueryString["ReLogin"] == "ReLogin")
            {
                Response.Write("<script type='text/javascript'>top.location.reload();</script>");
            }
            else
            {
                Response.Write("<script type='text/javascript'>top.opener=null;top.close();</script>");
            }
            Response.End();
        }
    }
}